package edu.zut.cs.software.propertymanagement.admin.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import edu.zut.cs.software.propertymanagement.admin.domain.Admin;
import edu.zut.cs.software.propertymanagement.admin.domain.Users;


public class AdminEntityGenerator extends GenericGenerator {



    @Autowired
    AdminManager adminManager;

    @Autowired
    UsersManager usersManager;
    
    @Test
    public void gen_admin() {
        for (int i = 0; i < 10; i++) {
            Admin g = new Admin();
            g.setUsername("username_" + i);
            this.adminManager.save(g);     
            for (int j = 0; j < 10; j++) {
                Admin admin = new Admin();
                admin.setPassword("password_" + i + "_" + j);
                g = this.adminManager.save(admin);
            }
        }
    }

    public void gen_users(Users g) {
        for (int i = 0; i < 10; i++) {
            Users u = new Users();
            u.setUsername("username_" + i);
            u.setPhone("phone_" + i);
            u.setRoom("room_"+i);
            this.usersManager.save(u);
        }
    }

}
